package user;

import java.util.*;

import edu.cmu.javadb.BaseRecord;
import edu.cmu.javadb.annotations.*;

@Record({@IndexOn({"Age"}), @IndexOn({"Height"})})
public class Person extends BaseRecord /*implements Comparable<Person>*/ {
	@Index
	private String name;
	
	@Link(Dept.class)
	private Dept dept;
	
//	@Inverse(Tag.class)
	private Collection<Tag> tags = new ArrayList<Tag>();
	
	private int age;
	
	private int height;
	
	private Person brother;
	
	private List<Integer> test = new ArrayList<Integer>();
	
	//@NoIndex
	//private VCollection<Person> relatives = new VCollection<Person>(true);
	
	public Person() {
		
	}
	
	public Person(String name, Dept dept) {
		this.name = name;
		this.dept = dept;
	}
	
	public Person(String name, int age, int height) {
		this.name = name;
		this.age = age;
		this.height = height;
		this.brother = null;
		test.add(14);
		test.add(18);
	}
	
	public Person(String name, int age, int height, Person brother) {
		this.name = name;
		this.age = age;
		this.height = height;
		this.brother = brother;
		test.add(14);
		test.add(18);
	}

	public void setAge(int age) {
		changeAttribute(age);
	}

	public int getAge() {
		return age;
	}

	public void setHeight(int height) {
		changeAttribute(height);
	}

	public int getHeight() {
		return height;
	}
	
	public String toString() {
		return "'" + name + ":" + age + ":" + height + "'";
	}

//	public VCollection<Person> getRelatives() {
//		return relatives;
//	}
//
//	public void setRelatives(VCollection<Person> relatives) {
//		this.relatives = relatives;
//	}

//	@Override
//	public int compareTo(Person o) {
//		return age - o.age;
//	}

	public Person getBrother() {
		return brother;
	}

	public void setBrother(Person brother) {
		this.brother = brother;
	}

	public List<Integer> getTest() {
		return test;
	}

	public void setTest(List<Integer> test) {
		this.test = test;
	}

	public Dept getDept() {
		return dept;
	}

	public void setDept(Dept dept) {
		this.changeAttribute(dept);
	}

	public Collection<Tag> getTags() {
		return tags;
	}

	public void setTags(Collection<Tag> tags) {
		this.tags = tags;
	}
	
	public void addTas(Tag tag) {
		this.tags.add(tag);
	}
}
